package com.comtop.springboot.templet.datasources;

import com.comtop.springboot.templet.datasources.annotation.DataSource;
import com.comtop.springboot.templet.modules.app.entity.UserEntity;
import com.comtop.springboot.templet.modules.app.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 测试
 * @author wangjiafang
 * @version 1.0
 * @since 2017/9/16 23:10
 */
@Service
public class DataSourceTestService {
    @Autowired
    private IUserService IUserService;

    public UserEntity queryObject(Long userId){
        return IUserService.selectById(userId);
    }

    @DataSource(name = DataSourceNames.SECOND)
    public UserEntity queryObject2(Long userId){
        return IUserService.selectById(userId);
    }
}
